<%@ page import="com.dao.UserDao" %>
<%@ page import="com.bean.User" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="com.bean.Friends" %>
<%@ page import="com.dao.FriendsDao" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%
  String fromQQ = request.getParameter("fromQQ");
  String toQQ = request.getParameter("toQQ");
  UserDao userDao = new UserDao();
  FriendsDao friendsDao = new FriendsDao();
  User user1 = userDao.findOne(fromQQ);
  User user2 = userDao.findOne(toQQ);
  PrintWriter writer =response.getWriter();
  if(user1.getId()==0 || user2.getId()==0){

    writer.write("-1");
  }else {

    friendsDao.delete(user1.getId(),user2.getId());
    friendsDao.delete(user2.getId(),user1.getId());

    writer.write("1");
  }
  writer.close();
%>